home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 13 / 013.d81 / dos #35 < prev    next >
Text File  |  2022-08-26  |  2KB  |  103 lines

  1. ======================================
  2.       DOS & Don'ts -- Part 35
  3.  
  4.       by James Gregory Weiler
  5. ======================================
  6.  
  7.        Part D: The Directory
  8. ======================================
  9.  
  10.   The directory contains the name
  11.  
  12. and address of every file on each
  13.  
  14. disk.
  15.  
  16.   The first two bytes of the BAM
  17.  
  18. block point to the directory.  The
  19.  
  20. directory normally resides at track 18
  21.  
  22. blocks 1 through 18.  However, after
  23.  
  24. that, the blocks are not laid out on
  25.  
  26. the disk in order.  Each is offset
  27.  
  28. from the previous block by at least
  29.  
  30. three intervening blocks.  Commodore
  31.  
  32. does that to speed up directory I/O.
  33.  
  34.   If your 1541 had to access block 1,
  35.  
  36. block 2, block 3, etc, in order, it
  37.  
  38. would take more than twice as long as
  39.  
  40. it does to read a directory.  Changing
  41.  
  42. the order of sectors in order to speed
  43.  
  44. up reading is known as interleaving or
  45.  
  46. skewing.  The 1541 skews disk files
  47.  
  48. the same way it skews the directory.
  49.  
  50.   Because everything except the BAM
  51.  
  52. can be stored on the disk higgledy-
  53.  
  54. piggledy, 1541 DOS needs some way to
  55.  
  56. find its way around.  DOS uses LINKS
  57.  
  58. to navigate.
  59.  
  60.   The first two bytes of each
  61.  
  62. directory block link it to the next
  63.  
  64. directory block.  Block 1 is linked to
  65.  
  66. block 4, block 4 to block 7, etc.
  67.  
  68. Look at map 3 to see the order in
  69.  
  70. which the blocks are linked.  The last
  71.  
  72. directory block with file names in it
  73.  
  74. links nowhere (track 0, block 255).
  75.  
  76. ======================================
  77.  
  78. Map 3: Typical directory track.
  79.  
  80. description          address/linked to
  81. --------------------------------------
  82. BAM:                  18,00 / 18,01
  83. directory block  1    18,01 / 18,04
  84. directory block  2    18,04 / 18,07
  85. directory block  3    18,07 / 18,10
  86. directory block  4    18,10 / 18,13
  87. directory block  5    18,13 / 18,16
  88. directory block  6    18,16 / 18,02
  89. directory block  7    18,02 / 18,05
  90. directory block  8    18,05 / 18,08
  91. directory block  9    18,08 / 18,11
  92. directory block 10    18,11 / 18,14
  93. directory block 11    18,14 / 18,17
  94. directory block 12    18,17 / 18,03
  95. directory block 13    18,03 / 18,06
  96. directory block 14    18,06 / 18,09
  97. directory block 15    18,09 / 18,12
  98. directory block 16    18,12 / 18,15
  99. directory block 17    18,15 / 18,18
  100. directory block 18    18,18 / 0,255
  101.  
  102. =======< continued in Part 36 >=======
  103.